#include <iostream>
#include <map>
#include <fstream>
#include <string>
using namespace std;

int main()
{
    map<string, string> map1;
    ifstream file("file");
    string line;

    while (getline(file, line))
    {
        string key = line.substr(0, line.find("=>"));

        size_t start = line.find("=>") + 3;
        size_t end = line.find(",", start);
        string value = line.substr(start, end - start - 1);

        map1.insert(pair<string, string>(key, value));
    }
    string key;
    while (1)
    {
        cout << "请输入拼音:";
        cin >> key;
        if (key == "exit")
        {
            break;
        }

        auto it = map1.find(key);
        if (it != map1.end())
        {
            int n = it->second.length()/3;
            if (n > 5)
                n = 5;
            
            
            for (int i = 0; i < n; i++)
            {
                cout << i+1 << ": " << it->second.substr(i*3,3) << " ";
            }
            cout << endl;
            
        }
        else
        {
            cout << "没有找到" << endl;
        }        
    }

    // for(auto &item:map1)
        // cout << item.first << " " << item.second << endl;
   
    file.close();
    return 0;
}